object.reduce 
Reduces an object to a value that is the accumulated result of running each property in the object through a callback.
Executes the callback function once for each own enumerable property in the object, receiving four arguments: the initial value (or value from the previous callback call), the value
of the current property, the key
of the current property, and the object
over which the function is iterating. Node.js/JavaScript utility.
Install with npm
npm i object.reduce --save
Install with bower
bower install object.reduce --save
Usage
A callback function is executed once for each own enumerable property in the object, receiving four arguments:
acc
: the initial value (or value from the previous callback call),value
: the of the current property,key
: the of the current property, and- the original
object
over which the function is iterating.
Example
var reduce = require('object.reduce');
var a = {a: 'foo', b: 'bar', c: 'baz'};
reduce(a, function (acc, value, key, obj) {
acc[key] = value.toUpperCase();
return acc;
}, {});
Related projects
Running tests
Install dev dependencies:
npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license.
This file was generated by verb-cli on April 25, 2015.